#include <Arduboy2.h>
Arduboy2 arduboy;
/*=========================================================
                         变量
  =========================================================*/
bool CN_text_BG = 0;
byte player_dyn = 0;     //玩家动态帧
byte Man_direction = 1;    //玩家方向
byte KeyBack = 255;          //按键返回
unsigned long Timer[4];  //时间列表 0 1 2 3对话框冷却
bool player_move = false; //玩家是否移动
bool key_lock = false; //键盘锁
bool move_lock = true; //方向锁
bool dialog; //对话框
int Entity[1][2] = {    //实体坐标
  {65, 29},   //注册为玩家
};
byte room, room_f;
/*=========================================================
                         常量
  =========================================================*/
#define dialog_cool_time 500
#define mobile_frame_time 250
#define key_cool_time 30
#define player_move_cool_time 250
#define MISAKI_FONT_F2_H
#define MISAKI_FONT_F2_PAGE 0xF2
#define MISAKI_FONT_F2_W 7
#define MISAKI_FONT_F2_SIZE 0x46
/*=========================================================
                         位图
  =========================================================*/
/*
  玩家
*/
const uint8_t Man_U_0[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
                                   0x00, 0x00, 0x80, 0xc0, 0x78, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0x78, 0xc0, 0x80, 0x00, 0x00,
                                  };
const uint8_t Man_U_1[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
                                   0x00, 0x00, 0x00, 0x80, 0xf8, 0x1f, 0xff, 0x3f, 0x3f, 0x7f, 0x9f, 0x38, 0x40, 0x40, 0x80, 0x00,
                                  };
const uint8_t Man_U_2[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
                                   0x00, 0x80, 0x40, 0x40, 0x38, 0x1f, 0x7f, 0xbf, 0x3f, 0xff, 0x1f, 0xf8, 0x80, 0x00, 0x00, 0x00,
                                  };
const uint8_t Man_U_3[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
                                   0x00, 0x00, 0x00, 0x80, 0xf8, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0x38, 0x40, 0x40, 0x80, 0x00,
                                  };
const uint8_t Man_U_4[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
                                   0x00, 0x80, 0x40, 0x40, 0x38, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0xf8, 0x80, 0x00, 0x00, 0x00,
                                  };
const uint8_t Man_D_0[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x68, 0x78, 0x68, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
                                   0x00, 0x00, 0x80, 0xc0, 0x78, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0x78, 0xc0, 0x80, 0x00, 0x00,
                                  };
const uint8_t Man_D_1[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x68, 0x78, 0x68, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
                                   0x00, 0x00, 0x00, 0x80, 0xf8, 0x1f, 0xff, 0x3f, 0x3f, 0x7f, 0x9f, 0x38, 0x40, 0x40, 0x80, 0x00,
                                  };
const uint8_t Man_D_2[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x68, 0x78, 0x68, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
                                   0x00, 0x80, 0x40, 0x40, 0x38, 0x1f, 0x7f, 0xbf, 0x3f, 0xff, 0x1f, 0xf8, 0x80, 0x00, 0x00, 0x00,
                                  };
const uint8_t Man_D_3[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x68, 0x78, 0x68, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
                                   0x00, 0x00, 0x00, 0x80, 0xf8, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0x38, 0x40, 0x40, 0x80, 0x00,
                                  };
const uint8_t Man_D_4[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x68, 0x78, 0x68, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
                                   0x00, 0x80, 0x40, 0x40, 0x38, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0xf8, 0x80, 0x00, 0x00, 0x00,
                                  };
const uint8_t Man_L_0[] PROGMEM = {0x00, 0x00, 0x78, 0x68, 0x78, 0x68, 0x78, 0x78, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00,
                                   0x00, 0x00, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0x01, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
                                  };
const uint8_t Man_L_1[] PROGMEM = {0x00, 0x00, 0x78, 0x68, 0x78, 0x68, 0x78, 0x78, 0x80, 0x40, 0x20, 0x20, 0x30, 0x00, 0x00, 0x00,
                                   0x00, 0x80, 0x5f, 0x3f, 0x3f, 0x3f, 0x3f, 0x5f, 0x81, 0x02, 0x02, 0x01, 0x01, 0x01, 0x0e, 0x00,
                                  };
const uint8_t Man_L_2[] PROGMEM = {0x00, 0x00, 0x78, 0x68, 0x78, 0x68, 0x78, 0x78, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00,
                                   0x00, 0x80, 0x5f, 0x3f, 0x3f, 0x3f, 0x3f, 0x5f, 0x81, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x00,
                                  };
const uint8_t Man_L_3[] PROGMEM = {0x00, 0x00, 0x78, 0x68, 0x78, 0x68, 0x78, 0x78, 0x80, 0x40, 0x20, 0x20, 0x30, 0x00, 0x00, 0x00,
                                   0x00, 0x00, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x0e, 0x00,
                                  };
const uint8_t Man_L_4[] PROGMEM = {0x00, 0x00, 0x78, 0x68, 0x78, 0x68, 0x78, 0x78, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00,
                                   0x00, 0x00, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x00,
                                  };

const uint8_t Man_R_0[] PROGMEM = {0x00, 0x00, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x78, 0x78, 0x68, 0x78, 0x68, 0x78, 0x00, 0x00,
                                   0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x02, 0x01, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0x00, 0x00,
                                  };
const uint8_t Man_R_1[] PROGMEM = {0x00, 0x00, 0x00, 0x30, 0x20, 0x20, 0x40, 0x80, 0x78, 0x78, 0x68, 0x78, 0x68, 0x78, 0x00, 0x00,
                                   0x00, 0x0e, 0x01, 0x01, 0x01, 0x02, 0x02, 0x81, 0x5f, 0x3f, 0x3f, 0x3f, 0x3f, 0x5f, 0x80, 0x00,
                                  };
const uint8_t Man_R_2[] PROGMEM = {0x00, 0x00, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x78, 0x78, 0x68, 0x78, 0x68, 0x78, 0x00, 0x00,
                                   0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x81, 0x5f, 0x3f, 0x3f, 0x3f, 0x3f, 0x5f, 0x80, 0x00,
                                  };
const uint8_t Man_R_3[] PROGMEM = {0x00, 0x00, 0x00, 0x30, 0x20, 0x20, 0x40, 0x80, 0x78, 0x78, 0x68, 0x78, 0x68, 0x78, 0x00, 0x00,
                                   0x00, 0x0e, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0x00, 0x00,
                                  };
const uint8_t Man_R_4[] PROGMEM = {0x00, 0x00, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x78, 0x78, 0x68, 0x78, 0x68, 0x78, 0x00, 0x00,
                                   0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x1f, 0xff, 0x3f, 0x3f, 0xff, 0x1f, 0x00, 0x00,
                                  };
const unsigned char *T_Man_direction[8][4] = {
  {Man_U_3, Man_U_0, Man_U_4, Man_U_0},
  {Man_U_1, Man_U_0, Man_U_2, Man_U_0},
  {Man_D_3, Man_D_0, Man_D_4, Man_D_0},
  {Man_D_1, Man_D_0, Man_D_2, Man_D_0},
  {Man_L_3, Man_L_0, Man_L_4, Man_L_0},
  {Man_L_1, Man_L_0, Man_L_2, Man_L_0},
  {Man_R_3, Man_R_0, Man_R_4, Man_R_0},
  {Man_R_1, Man_R_0, Man_R_2, Man_R_0}
};
/*
   博士
*/
const uint8_t D_D_0[] PROGMEM = {0xff, 0x1f, 0xef, 0x43, 0x31, 0xd9, 0xd8, 0x3c, 0x3c, 0xd8, 0xd9, 0x39, 0x43, 0xef, 0x1f, 0xff,
                                 0xff, 0xf3, 0xec, 0x8c, 0x31, 0x3c, 0x3a, 0xbb, 0xbb, 0x3a, 0x3c, 0x31, 0x8c, 0xec, 0xf3, 0xff,
                                };

//const uint8_t CG_0[] PROGMEM = {};
const uint8_t CG_1[] PROGMEM = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xb3, 0xb0,
                                0xb0, 0xb3, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xff, 0xf0, 0xef, 0xe0,
                                0xe0, 0xef, 0xe0, 0xef, 0xe0, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xe0, 0xef, 0xe0,
                                0xef, 0xe0, 0xe0, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xe0, 0xe0, 0xef, 0xef, 0xef,
                                0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xdf, 0x3f,
                                0xff, 0x07, 0xd7, 0xd7, 0xd7, 0xd7, 0xd7, 0x07, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f,
                                0x57, 0xd7, 0x17, 0x8f, 0x8f, 0x17, 0x57, 0xd7, 0x57, 0xd7, 0x17, 0x8f, 0x8f, 0x17, 0x57, 0xd7,
                                0x57, 0xd7, 0x17, 0x8f, 0x8f, 0x17, 0x57, 0xd7, 0x57, 0xd7, 0x17, 0x8f, 0x8f, 0x17, 0x57, 0xd7,
                                0x57, 0xd7, 0x17, 0x8f, 0x8f, 0x17, 0x57, 0xd7, 0x57, 0xd7, 0x17, 0x8f, 0x8f, 0x17, 0x57, 0x00,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0x00,
                                0x00, 0x86, 0x80, 0x9a, 0x98, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x98, 0x9a, 0x80,
                                0x86, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0xfe,
                                0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x01, 0xff, 0xff, 0xff, 0x00,
                                0xff, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0x8b, 0xbb,
                                0x5e, 0x5e, 0x40, 0x7f, 0x40, 0x1e, 0x5e, 0x1e, 0x5e, 0x5e, 0x00, 0x78, 0x40, 0x5e, 0x5e, 0x1e,
                                0x5e, 0x5e, 0x40, 0x7f, 0x40, 0x5e, 0x5e, 0x1e, 0x5e, 0x5e, 0x40, 0x7f, 0x40, 0x5e, 0x5e, 0x1e,
                                0x5e, 0x5e, 0x40, 0x7f, 0x40, 0x5e, 0x5e, 0x1e, 0x5e, 0x5e, 0x40, 0x7f, 0x40, 0x5e, 0x5e, 0x00,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
                                0xfd, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
                                0xfe, 0xfd, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xe7, 0xe7, 0xe7,
                                0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0x81, 0xbd, 0x8d, 0x30, 0x8d, 0xbd, 0x99, 0x00,
                                0xbd, 0x00, 0x00, 0xfd, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x07, 0xe7, 0xe0, 0xf0, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00,
                                0xff, 0x00, 0x00, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef,
                                0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0x0f, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0x80, 0xc0, 0xef, 0xef, 0xef, 0xef, 0xef, 0x0f,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x1f, 0xdf,
                                0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0x03, 0xfd, 0xfa, 0xf2, 0xe2, 0xea, 0xea, 0xea,
                                0xea, 0xea, 0xea, 0xe2, 0xf2, 0xfa, 0xfd, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfe, 0x02, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a,
                                0x7a, 0x02, 0xfe, 0xaa, 0xfe, 0xaa, 0xaa, 0x00, 0xf3, 0xf3, 0xf3, 0xf1, 0xf9, 0xf9, 0xf9, 0xf9,
                                0x00, 0xfe, 0xfe, 0xf2, 0xf2, 0x72, 0xbe, 0x3e, 0xbe, 0x72, 0xf2, 0xf2, 0xfe, 0x8a, 0xfe, 0x00,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf,
                                0xaf, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f,
                                0xaf, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0x00,
                                0x87, 0x8b, 0x87, 0x8b, 0x87, 0x8b, 0x87, 0x8b, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xcc, 0xd2, 0xd2, 0xcc, 0xd2, 0xd2, 0xcc, 0xd2,
                                0x56, 0x5a, 0x56, 0x5a, 0x56, 0x5a, 0x56, 0x5a, 0x00, 0x7f, 0x6b, 0x7f, 0x6b, 0x7f, 0x6b, 0x7f,
                                0x6f, 0x6f, 0x6f, 0x6f, 0x77, 0x78, 0x7f, 0x00, 0x56, 0x5a, 0x56, 0x5a, 0x56, 0x5a, 0x56, 0x5a,
                                0x00, 0x7f, 0x7f, 0x7f, 0x78, 0x75, 0x6d, 0x60, 0x6d, 0x75, 0x78, 0x7f, 0x7f, 0x7f, 0x7f, 0x00,
                                0x79, 0x79, 0x79, 0x79, 0x01, 0x03, 0x7f, 0x7f, 0x7f, 0x07, 0x7b, 0x0b, 0x6b, 0x03, 0x7d, 0x0e,
                                0x36, 0x3b, 0x3b, 0x1b, 0x3a, 0x3a, 0x35, 0x0b, 0x7f, 0x0b, 0x35, 0x3a, 0x3a, 0x1b, 0x3b, 0x3b,
                                0x36, 0x0e, 0x7c, 0x00, 0x7c, 0x06, 0x76, 0x76, 0x00, 0x7f, 0x6a, 0x7f, 0x6a, 0x6a, 0x7f, 0x00,
                                0x87, 0x8b, 0x87, 0x8b, 0x87, 0x8b, 0x87, 0x8b, 0x00, 0x3f, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
                                0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0x3f, 0x00, 0x56, 0x5a, 0x56, 0x5a, 0x56, 0x5a, 0x56, 0x5a,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd,
                                0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                               };
const uint8_t CG_2[] PROGMEM = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0x01, 0xf4, 0xf4, 0xf4, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74,
                                0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7b, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0x7b, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0x7b, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0x5e, 0xa7, 0x9b, 0x35, 0x35, 0x9b, 0xa7, 0x5e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x7e, 0xbd, 0xdb, 0xe7, 0xe7, 0xdb, 0xbd, 0x7e,
                                0x7e, 0xbd, 0xdb, 0xe7, 0xe7, 0xdb, 0xbd, 0x7e, 0x7e, 0xbd, 0xdb, 0xe7, 0xe7, 0xdb, 0xbd, 0x7e,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7b, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb7, 0xb5, 0x05, 0x75, 0x75, 0x05, 0xb5, 0xb7,
                                0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x7e, 0xbd, 0xdb, 0xe7, 0xe7, 0xdb, 0xbd, 0x7e,
                                0x7e, 0xbd, 0xdb, 0xe7, 0xe7, 0xdb, 0xbd, 0x7e, 0x7e, 0xbd, 0xdb, 0xe7, 0xe7, 0xdb, 0xbd, 0x7e,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0x7b, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x5e, 0xa7, 0x9b, 0x35, 0x35, 0x9b, 0xa7, 0x5e,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0x80, 0x2f, 0x2f, 0x2f, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
                                0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
                                0xee, 0x78, 0xf4, 0xf8, 0xdc, 0xaa, 0xdc, 0xaa, 0xee, 0x78, 0xf4, 0xf8, 0xdc, 0xaa, 0xdc, 0xaa,
                                0x7c, 0x11, 0xab, 0x53, 0xa7, 0x4f, 0xbf, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x81, 0x95, 0xa9, 0xb5, 0xb9, 0xbd, 0xbd, 0x81,
                                0x81, 0x95, 0xa9, 0xb5, 0xb9, 0xbd, 0xbd, 0x81, 0x81, 0x95, 0xa9, 0xb5, 0xb9, 0xbd, 0xbd, 0x81,
                                0xef, 0x79, 0xf5, 0xfa, 0xdd, 0xae, 0xdf, 0xad, 0xef, 0x79, 0xf5, 0xfa, 0xdd, 0xae, 0xdf, 0xad,
                                0x7e, 0x11, 0xa2, 0x55, 0xaa, 0x51, 0xa8, 0x14, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd, 0xff, 0xff,
                                0xff, 0x7b, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x36, 0xb6, 0xb6, 0x86, 0xb6, 0xb6, 0xb6, 0x30,
                                0x36, 0xb6, 0xb6, 0x86, 0xb6, 0xb6, 0xb6, 0x30, 0x36, 0xb6, 0xb6, 0x86, 0xb6, 0xb6, 0xb6, 0x30,
                                0xef, 0x79, 0xf5, 0xfa, 0xdd, 0xae, 0xdf, 0xad, 0xef, 0x79, 0xf5, 0xfa, 0xdd, 0xae, 0xdf, 0xad,
                                0x7e, 0x11, 0xa2, 0x55, 0xaa, 0x51, 0xa8, 0x14, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0x7b, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x36, 0xb6, 0xb6, 0x86, 0xb6, 0xb6, 0xb6, 0x30,
                                0x36, 0xb6, 0xb6, 0x86, 0xb6, 0xb6, 0xb6, 0x30, 0xff, 0xff, 0x01, 0xfd, 0x05, 0x75, 0x75, 0x75,
                                0xef, 0x79, 0xf5, 0xfa, 0xdd, 0xae, 0xdf, 0xad, 0xef, 0x79, 0xf5, 0xfa, 0xdd, 0xae, 0xdf, 0xad,
                                0x7e, 0x7d, 0x7a, 0xb5, 0x4a, 0x9d, 0xaa, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7b, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd,
                                0xff, 0x7b, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd, 0xff, 0x7b, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdd,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xc0, 0xc0, 0xb6, 0x86, 0x86, 0x86, 0x86, 0x86,
                                0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x7e, 0x7e, 0x00, 0xbf, 0xa0, 0xae, 0xa0, 0xae,

                               };
PROGMEM const uint8_t misaki_font_f2[ MISAKI_FONT_F2_SIZE + 1 ][ MISAKI_FONT_F2_W ] =
{
  { 0x12, 0x7a, 0x47, 0x4a, 0x7e, 0x4a, 0x42 }, /* 0x00 在 */
  { 0x52, 0x7f, 0x4a, 0x5a, 0x2f, 0x5a, 0x42 }, /* 0x01 技 */
  { 0x0a, 0x7d, 0x1a, 0x7f, 0x1a, 0x45, 0x7d }, /* 0x02 術 */
  { 0x4c, 0x3f, 0x5b, 0x2f, 0x7b, 0x2f, 0x5b }, /* 0x03 爆 */
  { 0x4c, 0x3f, 0x24, 0x03, 0x7e, 0x2a, 0x2a }, /* 0x04 炸 */
  { 0x01, 0x01, 0x01, 0x7f, 0x05, 0x09, 0x01 }, /* 0x05 下 */
  { 0x40, 0x20, 0x18, 0x07, 0x18, 0x20, 0x40 }, /* 0x06 人 */
  { 0x04, 0x7e, 0x7f, 0x07, 0x00, 0x47, 0x7f }, /* 0x07 們 */
  { 0x7f, 0x2b, 0x7b, 0x28, 0x7b, 0x2b, 0x7f }, /* 0x08 開 */
  { 0x0a, 0x55, 0x6b, 0x01, 0x5a, 0x2d, 0x5a }, /* 0x09 發 */
  { 0x70, 0x4e, 0x48, 0x7f, 0x48, 0x4e, 0x70 }, /* 0x0A 出 */
  { 0x04, 0x7e, 0x13, 0x3e, 0x5f, 0x76, 0x1a }, /* 0x0B 傳 */
  { 0x49, 0x38, 0x62, 0x6b, 0x5e, 0x6b, 0x62 }, /* 0x0C 送 */
  { 0x50, 0x15, 0x15, 0x7b, 0x11, 0x09, 0x50 }, /* 0x0D 系 */
  { 0x2a, 0x75, 0x4a, 0x3e, 0x0b, 0x76, 0x4a }, /* 0x0E 統 */
  { 0x49, 0x38, 0x7d, 0x55, 0x7d, 0x57, 0x7d }, /* 0x0F 通 */
  { 0x49, 0x3a, 0x40, 0x78, 0x6f, 0x49, 0x7f }, /* 0x10 過 */
  { 0x01, 0x1d, 0x15, 0x1d, 0x41, 0x7f, 0x01 }, /* 0x11 可 */
  { 0x20, 0x1f, 0x50, 0x42, 0x24, 0x3f, 0x40 }, /* 0x12 以 */
  { 0x49, 0x5d, 0x3b, 0x2d, 0x0e, 0x40, 0x7f }, /* 0x13 到 */
  { 0x04, 0x7e, 0x09, 0x4a, 0x7e, 0x49, 0x08 }, /* 0x14 任 */
  { 0x04, 0x7e, 0x01, 0x1d, 0x15, 0x5d, 0x7f }, /* 0x15 何 */
  { 0x24, 0x3f, 0x08, 0x7e, 0x44, 0x5f, 0x6c }, /* 0x16 地 */
  { 0x42, 0x22, 0x1e, 0x0b, 0x4a, 0x7a, 0x02 }, /* 0x17 方 */
  { 0x62, 0x1f, 0x7a, 0x14, 0x7b, 0x26, 0x52 }, /* 0x18 旅 */
  { 0x0a, 0x7d, 0x04, 0x05, 0x45, 0x7d, 0x04 }, /* 0x19 行 */
  { 0x5f, 0x1f, 0x75, 0x2a, 0x57, 0x32, 0x4f }, /* 0x1A 駿 */
  { 0x40, 0x32, 0x22, 0x53, 0x4a, 0x46, 0x40 }, /* 0x1B 之 */
  { 0x57, 0x34, 0x7f, 0x08, 0x2a, 0x4d, 0x7b }, /* 0x1C 將 */
  { 0x06, 0x3a, 0x52, 0x53, 0x4a, 0x4a, 0x66 }, /* 0x1D 它 */
  { 0x7a, 0x2a, 0x7b, 0x02, 0x1a, 0x43, 0x7a }, /* 0x1E 前 */
  { 0x0a, 0x7d, 0x44, 0x55, 0x7e, 0x54, 0x44 }, /* 0x1F 往 */
  { 0x40, 0x4c, 0x20, 0x1f, 0x28, 0x44, 0x40 }, /* 0x20 火 */
  { 0x50, 0x4f, 0x55, 0x7d, 0x55, 0x57, 0x44 }, /* 0x21 星 */
  { 0x28, 0x1a, 0x4f, 0x6a, 0x4f, 0x1a, 0x28 }, /* 0x22 基 */
  { 0x40, 0x3e, 0x4a, 0x3e, 0x3b, 0x3e, 0x4a }, /* 0x23 廣 */
  { 0x52, 0x7f, 0x15, 0x6f, 0x7d, 0x6f, 0x15 }, /* 0x24 播 */
  { 0x7f, 0x55, 0x5f, 0x20, 0x7f, 0x01, 0x1f }, /* 0x25 即 */
  { 0x44, 0x5c, 0x37, 0x2c, 0x6c, 0x6b, 0x6c }, /* 0x26 始 */
  { 0x04, 0x7e, 0x2d, 0x3b, 0x29, 0x4e, 0x7f }, /* 0x27 倒 */
  { 0x6a, 0x6b, 0x62, 0x04, 0x04, 0x7f, 0x04 }, /* 0x28 計 */
  { 0x3e, 0x2a, 0x3e, 0x6a, 0x2f, 0x7a, 0x28 }, /* 0x29 時 */
  { 0x42, 0x3f, 0x42, 0x7e, 0x7e, 0x42, 0x7e }, /* 0x2A 加 */
  { 0x49, 0x3a, 0x6e, 0x5a, 0x7f, 0x5a, 0x6e }, /* 0x2B 速 */
  { 0x28, 0x6b, 0x6b, 0x1c, 0x6b, 0x6b, 0x28 }, /* 0x2C 器 */
  { 0x42, 0x4a, 0x3e, 0x0b, 0x76, 0x4a, 0x62 }, /* 0x2D 充 */
  { 0x04, 0x7e, 0x2d, 0x7e, 0x00, 0x7f, 0x5a }, /* 0x2E 能 */
  { 0x41, 0x79, 0x41, 0x7f, 0x49, 0x49, 0x41 }, /* 0x2F 正 */
  { 0x52, 0x7f, 0x40, 0x3e, 0x1a, 0x79, 0x28 }, /* 0x30 拆 */
  { 0x48, 0x44, 0x2b, 0x18, 0x4b, 0x7c, 0x08 }, /* 0x31 分 */
  { 0x35, 0x7e, 0x43, 0x7e, 0x63, 0x5e, 0x42 }, /* 0x32 粒 */
  { 0x08, 0x09, 0x49, 0x7d, 0x0b, 0x09, 0x08 }, /* 0x33 子 */
  { 0x7e, 0x02, 0x3a, 0x2b, 0x3a, 0x42, 0x7e }, /* 0x34 向 */
  { 0x00, 0x7f, 0x55, 0x55, 0x55, 0x55, 0x7f }, /* 0x35 目 */
  { 0x1a, 0x7f, 0x51, 0x17, 0x77, 0x17, 0x51 }, /* 0x36 標 */
  { 0x2e, 0x33, 0x2e, 0x70, 0x5f, 0x54, 0x74 }, /* 0x37 站 */
  { 0x50, 0x5e, 0x2b, 0x7e, 0x0a, 0x52, 0x7f }, /* 0x38 射 */
  { 0x56, 0x52, 0x36, 0x17, 0x76, 0x52, 0x56 }, /* 0x39 完 */
  { 0x40, 0x3e, 0x4a, 0x3a, 0x42, 0x3f, 0x52 }, /* 0x3A 成 */
  { 0x22, 0x3e, 0x12, 0x42, 0x3f, 0x42, 0x7e }, /* 0x3B 功 */
  { 0x44, 0x5b, 0x2e, 0x7c, 0x2b, 0x2e, 0x62 }, /* 0x3C 第 */
  { 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08 }, /* 0x3D 一 */
  { 0x28, 0x3a, 0x2e, 0x6b, 0x2e, 0x3a, 0x28 }, /* 0x3E 章 */
  { 0x09, 0x37, 0x31, 0x3e, 0x5a, 0x2f, 0x5e }, /* 0x3F 破 */
  { 0x0a, 0x66, 0x7f, 0x56, 0x7f, 0x76, 0x12 }, /* 0x40 舊 */
  { 0x04, 0x7f, 0x44, 0x5f, 0x54, 0x5f, 0x44 }, /* 0x41 世 */
  { 0x20, 0x5f, 0x35, 0x1f, 0x75, 0x1f, 0x20 }, /* 0x42 界 */
  { 0x12, 0x2f, 0x4a, 0x7f, 0x5c, 0x23, 0x5e }, /* 0x43 敬 */
  { 0x6a, 0x63, 0x08, 0x7a, 0x2f, 0x7a, 0x08 }, /* 0x44 請 */
  { 0x7f, 0x5b, 0x37, 0x10, 0x7b, 0x37, 0x7f }, /* 0x45 關 */
  { 0x6a, 0x6b, 0x44, 0x55, 0x7e, 0x54, 0x44 }, /* 0x46 註 */
};


/*=========================================================
                          文本
  =========================================================*/
PROGMEM const uint8_t misaki_font_0x00[1] = { 0x00 };
//PROGMEM const uint8_t mes[] =
PROGMEM const uint8_t mes1[] = { 0xf2, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, };
//通過傳送人們可以到任何地方旅行
PROGMEM const uint8_t mes2[] = {0xf2, 0x0f, 0x10, 0x0b, 0x0c, 0x06, 0x07, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,};
PROGMEM const uint8_t mes3[] = { 0xf2, 0x1a, 0x1b, 0x1c, 0x0f, 0x10, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x16, };
PROGMEM const uint8_t mes4[] = { 0xf2, 0x23, 0x24, 0xf1, 0x00, 0xf2, 0x25, 0x1c, 0x0b, 0x0c, 0x08, 0x26, 0x27, 0x28, 0x29, };
PROGMEM const uint8_t mes5[] = { 0xf2, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x00, 0x30, 0x31, 0x32, 0x33, 0x2f, 0x00, 0x0b, 0x0c, };
PROGMEM const uint8_t mes6[] = { 0xf2, 0x34, 0x35, 0x36, 0x0b, 0x0c, 0x37, 0x09, 0x38, 0x32, 0x33, };
PROGMEM const uint8_t mes7[] = { 0xf2, 0x39, 0x3a, 0xf1, 0x00, 0xf2, 0x3a, 0x3b, 0x0b, 0x0c, };
PROGMEM const uint8_t mes8[] = { 0xf2, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, };
PROGMEM const uint8_t mes9[] = { 0xf2, 0x43, 0x44, 0x45, 0x46, };
/*====================================================================
                             软重启函数
  ====================================================================*/
void(* resetFunc) (void) = 0; //制造重启命令
/*=========================================================
                     只循环一次
  =========================================================*/
void setup() {
  arduboy.boot();
  Serial.begin(115200);
  arduboy.setTextColor(0);
  arduboy.setTextBackground(1);
}
/*=========================================================
                     不停循环
  =========================================================*/
void loop() {
  if (!key_lock) key();
  logic();
  draw();
}
void draw() {
  arduboy.clear();
  switch (room) {
    case 0:
      arduboy.drawBitmap(0, 0, CG_1, 128, 64, 1);
      for (byte i = 0; i < 17; i++) arduboy.drawPixel(random(11, 17), random(43, 47), 0);  //随机点
      arduboy.drawPixel(random(66, 69), 52, 0);  //随机点
      arduboy.drawPixel(random(76, 79), 52, 0);  //随机点
      draw_player();
      //arduboy.setCursor(0, 0);
      //arduboy.print(room_f);
      // arduboy.print(Entity[0][0]);
      // arduboy.print(F(","));
      //arduboy.print(Entity[0][1]);
      switch (room_f) {
        case 0:
          dialog = true;
          drawText(0, 57, mes1, sizeof(mes1));
          break;
        case 1:
          drawText(0, 57, mes2, sizeof(mes2));
          break;
        case 2:
          drawText(0, 57, mes3, sizeof(mes3));
          break;
        case 3:
          drawText(0, 57, mes4, sizeof(mes4));
          break;
        case 4:
          arduboy.setCursor(0, 57);
          arduboy.print(F("5 4 3 2 1 0..."));
          break;
        case 5:
          dialog = false;
          arduboy.fillRect(0, 0, 128, 64, 0);
          room_f++;
          break;
        case 6:
          delay(250);
          room_f++;
          break;
        case 7:
          dialog = true;
          drawText(0, 57, mes5, sizeof(mes5));
          for (byte i = 0; i < 137; i++) arduboy.drawPixel(random(64, 82), random(17, 44), 0);  //随机点
          break;
        case 8:
          drawText(0, 57, mes6, sizeof(mes6));
          arduboy.fillRect(63, 21, 19, 24, 1);
          for (byte i = 0; i < 54; i++) arduboy.drawPixel(random(105, 119), random(36, 54), 0);  //随机点
          break;
        case 9:
          dialog = false;
          arduboy.fillRect(0, 0, 128, 64, 1);
          room_f++;
          break;
        case 10:
          delay(250);
          arduboy.fillRect(63, 21, 19, 24, 1);
          room_f++;
          break;
        case 11:
          dialog = true;
          arduboy.fillRect(63, 21, 19, 24, 1);
          drawText(0, 57, mes7, sizeof(mes7));
          break;
        case 12:
          room = 1;
          room_f = 0;
          arduboy.fillRect(63, 21, 19, 24, 1);
          break;
      }
      break;
    case 1:
      arduboy.drawBitmap(0, 0, CG_2, 128, 64, 1);
      switch (room_f) {
        case 0:
          dialog = false;
          drawText(0, 0, mes8, sizeof(mes8));
          drawText(40, 48, mes9, sizeof(mes9));
          break;
      }
      break;
  }

  arduboy.display();
}
void draw_player() {
  arduboy.drawBitmap(Entity[0][0], Entity[0][1], T_Man_direction[Man_direction * 2 + player_move][player_dyn], 16, 16, 0);
  if (millis() >= mobile_frame_time + Timer[0]) {  //移动帧时间
    Timer[0] = millis();   //重置移动帧计时器
    player_dyn++; //下一个动态帧
    if (player_dyn >= 4) player_dyn = 0;
  }
}
void key() {
  if (millis() >= key_cool_time + Timer[1]) {
    Timer[1] = millis();   //重置移动帧计时器
    /*
        0  1  2  3  4  5
        ↑ ↓← →  A  B
    */
    KeyBack = 255;
    if (arduboy.pressed(UP_BUTTON)) KeyBack = 0;
    if (arduboy.pressed(DOWN_BUTTON)) KeyBack = 1;
    if (arduboy.pressed(LEFT_BUTTON)) KeyBack = 2;
    if (arduboy.pressed(RIGHT_BUTTON)) KeyBack = 3;
    if (arduboy.pressed(A_BUTTON)) KeyBack = 4;
    if (arduboy.pressed(B_BUTTON)) KeyBack = 5;
  }
}
void logic() {
  if (KeyBack < 4) {
    player_move = true;
    Man_direction = KeyBack;
  } else player_move = false;
  switch (KeyBack) {
    case 0:
      if (!move_lock) Entity[0][1]--;
      break;
    case 1:
      if (!move_lock) Entity[0][1]++;
      break;
    case 2:
      if (!move_lock) Entity[0][0]--;
      break;
    case 3:
      if (!move_lock) Entity[0][0]++;
      break;
    case 4:
      if (dialog && millis() >= dialog_cool_time + Timer[3]) {
        room_f++;
        Timer[3] = millis();
      }
      break;
    case 5:

      break;
  }
}
void drawText(uint8_t x, uint8_t y, const uint8_t *mes, uint8_t cnt)
{
  uint8_t pb;
  uint8_t page;
  uint8_t screen_start = 0;
  uint8_t screen_end = 128;
  if (x < screen_start) {
    x = screen_start;
  }
  for (uint8_t i = 0; i < cnt; i++) {
    pb = pgm_read_byte_near(mes + i);
    page = MISAKI_FONT_F2_PAGE;
    if (pb > MISAKI_FONT_F2_SIZE) {
      continue;
    }
    if ((x + 8) > screen_end) {
      x = screen_start;
      y = y + 8;
    }
    arduboy.drawBitmap(x, y,  misaki_font_f2[ pb ], MISAKI_FONT_F2_W, 8, CN_text_BG);
    arduboy.drawBitmap(x + 7, y, misaki_font_0x00, 1, 8, CN_text_BG);
    x = x + 8;
  }
}

